package com.bussiness;

public class PersonBussinessProxy implements com.bussiness.PersonBussiness {
  private String _endpoint = null;
  private com.bussiness.PersonBussiness personBussiness = null;
  
  public PersonBussinessProxy() {
    _initPersonBussinessProxy();
  }
  
  public PersonBussinessProxy(String endpoint) {
    _endpoint = endpoint;
    _initPersonBussinessProxy();
  }
  
  private void _initPersonBussinessProxy() {
    try {
      personBussiness = (new com.bussiness.PersonBussinessServiceLocator()).getPersonBussiness();
      if (personBussiness != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)personBussiness)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)personBussiness)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (personBussiness != null)
      ((javax.xml.rpc.Stub)personBussiness)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public com.bussiness.PersonBussiness getPersonBussiness() {
    if (personBussiness == null)
      _initPersonBussinessProxy();
    return personBussiness;
  }
  
  public int createUser(com.beans.Person userData) throws java.rmi.RemoteException, com.exceptions.ServiceUnavailableException, com.exceptions.DuplicateUserIdException{
    if (personBussiness == null)
      _initPersonBussinessProxy();
    return personBussiness.createUser(userData);
  }
  
  public com.beans.Person validateUser(com.beans.Person user) throws java.rmi.RemoteException, com.exceptions.PasswordNotMatchingException, com.exceptions.ServiceUnavailableException, com.exceptions.InvalidUserNamePasswordException{
    if (personBussiness == null)
      _initPersonBussinessProxy();
    return personBussiness.validateUser(user);
  }
  
  public int updateUser(com.beans.Person userData) throws java.rmi.RemoteException, com.exceptions.ServiceUnavailableException{
    if (personBussiness == null)
      _initPersonBussinessProxy();
    return personBussiness.updateUser(userData);
  }
  
  public int removeUser(java.lang.String emailId) throws java.rmi.RemoteException, com.exceptions.ServiceUnavailableException, com.exceptions.DeleteCustomerWithOutstandingMovieException{
    if (personBussiness == null)
      _initPersonBussinessProxy();
    return personBussiness.removeUser(emailId);
  }
  
  
}